<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

class CreateCmsPostsTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('cms_posts', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('title',120)->comment('标题');
            $table->integer('category_id')->unsigned()->default(0)->index()->comment('栏目id');
            $table->string('type',15)->default('article')->comment('类型');
            $table->string('author',60)->nullable()->comment('作者');
            $table->string('copyfrom',60)->nullable()->comment('来源');
            $table->string('thumb','120')->nullable()->comment('封面图');
            $table->string('keywords',120)->nullable()->comment('关键词');
            $table->string('description')->nullable()->comment('简介');
            $table->mediumText('content')->comment('内容');
            $table->dateTime('published_at')->nullable()->comment('发布时间');
            $table->timestamps();
            $table->softDeletes();
            $table->engine="InnoDb";
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('cms_posts');
    }
}
